Skip to content

Conversation

@hnrklssn
Copy link
Member

In fceb9ce (llvm#134769) upstream changed the diagnostic engine to always wrap expressions in single quotes. We already had manual wrapping for most of those, so the manual single quotes needed to be removed. In other placed the test cases needed to be updated to reflect the new output.

rdar://149359009

In fceb9ce upstream changed the
diagnostic engine to always wrap expressions in single quotes. We
already had manual wrapping for most of those, so the manual single
quotes needed to be removed. In other placed the test cases needed to be
updated to reflect the new output.

rdar://149359009
@hnrklssn hnrklssn added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Apr 22, 2025
@hnrklssn
Copy link
Member Author

@swift-ci please test llvm

Copy link

@delcypher delcypher left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the double single quotes looks a little weird but I think we should land the test fixes first and debate this separately. These tests being broken is blocking me so I'd rather we just landed this.

def err_bounds_safety_terminated_by_terminator_mismatch : Error<
"array '%0' with '__terminated_by' attribute is initialized with an "
"incorrect terminator (expected: %1; got %2)">;
"incorrect terminator (expected: %quoted1; got %quoted2)">;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems new. Looking at the implementation it looks like this just adds single quotes around the argument. Presumably this is related to llvm#134769 (comment) and now we have double single quotes in the outputted diagnostics?

// expected-error@+5{{array 'qux2.foo.a' with '__terminated_by' attribute is initialized with an incorrect terminator (expected: '0'; got '1')}}
// expected-error@+4{{array 'qux2.foo.b' with '__terminated_by' attribute is initialized with an incorrect terminator (expected: '42'; got '2')}}
// expected-error@+3{{array 'qux2.bar.a' with '__terminated_by' attribute is initialized with an incorrect terminator (expected: '0'; got '3')}}
// expected-error@+2{{array 'qux2.baz.a' with '__terminated_by' attribute is initialized with an incorrect terminator (expected: ''X''; got '0')}}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so the character literal is double single quoted, and the integer literal is single quoted. It looks a little weird but I guess this is consistent with what upstream currently has.

@delcypher
Copy link

delcypher commented Apr 23, 2025

For macOS

********************
Failed Tests (7):
  Clang :: BoundsSafety/CodeGen/bounds-attributed-in-return-null-system-header-O2.c
  Clang :: BoundsSafety/CodeGen/nested-struct-member-count-O2.c
  Clang :: BoundsSafety/CodeGen/terminated-by-to-indexable-trivial-O2.c
  Clang :: BoundsSafety/FixIt/null_terminated_bidi_indexable_conv.c
  Clang :: BoundsSafety/Sema/terminated-by-attr.c
  Clang :: SemaCXX/warn-unsafe-buffer-usage-count-attributed-pointer-argument.cpp
  Clang :: SemaCXX/warn-unsafe-buffer-usage-libc-functions-interop.cpp

@hnrklssn Are these failures unrelated?

Upstream now folds (gep inbounds null, X) -> null. This updates our O2
tests to reflect the new output.
Caused by 5a99355
(llvm#130742).
@hnrklssn
Copy link
Member Author

For macOS

********************
Failed Tests (7):
  Clang :: BoundsSafety/CodeGen/bounds-attributed-in-return-null-system-header-O2.c
  Clang :: BoundsSafety/CodeGen/nested-struct-member-count-O2.c
  Clang :: BoundsSafety/CodeGen/terminated-by-to-indexable-trivial-O2.c
  Clang :: BoundsSafety/FixIt/null_terminated_bidi_indexable_conv.c
  Clang :: BoundsSafety/Sema/terminated-by-attr.c
  Clang :: SemaCXX/warn-unsafe-buffer-usage-count-attributed-pointer-argument.cpp
  Clang :: SemaCXX/warn-unsafe-buffer-usage-libc-functions-interop.cpp

@hnrklssn Are these failures unrelated?

These seem unrelated, the others should be fixed now. Merging to unblock.

Clang :: BoundsSafety/FixIt/null_terminated_bidi_indexable_conv.c
Clang :: BoundsSafety/Sema/terminated-by-attr.c

@hnrklssn hnrklssn merged commit 6032297 into swiftlang:next Apr 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants